<template>
  <div class="cart-item" v-for="item in cart.cartList">
    <van-checkbox v-model="item.ischeck"></van-checkbox>
    <van-card
      :price="item.originprice"
      :title="item.proname"
      :thumb="item.img1"
    >
      <template #num>
        <van-stepper
          v-model="item.num"
          theme="round"
          button-size="22"
          disable-input
        />
      </template>
    </van-card>
  </div>
  <van-submit-bar :price="cart.allInfo.allPrice" button-text="提交订单">
    <van-checkbox v-model="cart.allInfo.allCheck" @click="handleAllCheck"
      >全选</van-checkbox
    >
  </van-submit-bar>
</template>

<script setup lang="ts">
import { useCart } from "../store/cart";
const cart = useCart();
const handleAllCheck = () => {
  let { allInfo, cartAllCheckAction } = cart;
  cartAllCheckAction(allInfo.allCheck);
  console.log(cart.allInfo.allCheck);
};
</script>

<style lang="scss" scoped>
.cart-item {
  display: flex;
  align-items: center;
  .van-card {
    /* background-color: red; */
    flex: 1;
  }
}
.van-submit-bar {
  bottom: 50px;
}
</style>
